package s01;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @ClassName ClientTCP
 * @Description 客户端实现
 * @Author Li
 * @Date 2022/8/13 9:28
 * @ModifyDate 2022/8/13 9:28
 * @Version 1.0
 */
public class ClientTCP {
    public static void main(String[] args) throws IOException {
        // 1.用IP和端口号创建Socket对象
        Socket socket = new Socket("127.0.0.1", 6666);
        // 2.获取输出流对象
        OutputStream os = socket.getOutputStream();
        // 3.写数据
        os.write("我是客户端发来的数据！！！".getBytes());
        // 4.关闭资源
        os.close();
        socket.close();

    }
}
